package com.fengchao.api.dao.cfi;

import com.fengchao.api.dao.BaseMapper;
import com.fengchao.model.entity.Crowdfunding;
import com.fengchao.model.cfi.CfiConcertCrowdfundingSingal;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;
import java.util.Map;


public interface CfiConcertCrowdfundingSingalMapper extends BaseMapper<CfiConcertCrowdfundingSingal> {

    /**
     * 查询众筹list
     *
     * @param start
     * @param count
     * @param rank  1:热门排序 2:最新上线 3:准备上线
     * @return
     */
    List<Crowdfunding> findCrowdfundingList(@Param("start") Integer start, @Param("count") Integer count, @Param("rank") Integer rank, @Param("date") Date date);

    /**
     * 查询众筹list条数
     *
     * @return
     */
    Integer findCrowdfundingListTotal(@Param("rank") Integer rank, @Param("date") Date date);

    /**
     * 查询收藏的众筹
     *
     * @return
     */
    List<Map> findFavoriteCrowdfundingList(@Param("start") Integer start, @Param("count") Integer count, @Param("userId") Integer userId);

    /**
     * 根据回报id查询众筹
     *
     * @param payBackId
     * @return
     */
    CfiConcertCrowdfundingSingal findCfiConcertCrowdfundingSingalByPayBackId(Integer payBackId);

    /**
     * 根据众筹id查询众筹
     *
     * @param crowdfundingId
     * @return
     */
    Crowdfunding findCrowdfundingByCrowdfundingId(Integer crowdfundingId);


    /**
     * 根据id查询允许购买的众筹
     *
     * @param crowdfundingId
     * @return
     */
    Crowdfunding findAllowedBuyCrowdfundingByCrowdfundingId(@Param("crowdfundingId") Integer crowdfundingId);

    /**
     * 模糊查询名字相关的众筹信息
     *
     * @param name
     * @param start
     * @param count
     * @return
     */
    List<Crowdfunding> findCrowdfundingByLinkName(@Param("name") String name, @Param("start") Integer start, @Param("count") Integer count);



}